export default {
    namespaced: true,
    state: {
        // 是否显示登录模态框
        isShowToast: false,
        toastMsg: '我是提示内容',
        toastType: 'warning'
    },
    mutations: {
        // 修改是否显示登录模态框状态
        changeIsShowToast(state, payload) {
            state.isShowToast = payload.isShow
            if (payload.isShow) {
                state.toastMsg = payload.msg,
                state.toastType = payload.type
            }

        }
    },
    actions: {
        asyncIsShowToast(context, payload) {
            context.commit("changeIsShowToast", {
                isShow: true,
                msg: payload.msg,
                type: payload.type
            })
            setTimeout(() => {
                context.commit("changeIsShowToast", {
                    isShow: false,
                    msg: payload.msg,
                    type: payload.type
                })
            }, 1500)
        }
    },
}